/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-07-05 15:15:45
 * @LastEditTime : 2023-07-07 14:43:02
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\TwoRouter\ProjectSchedule.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { BuiltInData } from '../Common/common'
import { AddDataButton, DelDataButton } from '../Common/options'

export const ProjectSchedule = async ({ OptionsEvent, oneData, Permission }) => {
    let dataList = {
        hideInSearch: true,
        pageSize: 10,
        params: { pageIndex: 1, organizationUuid: oneData.uuid, OrderField: 'projectScheduleType@asc' },
        initialValues: { organizationUuid: oneData.uuid },
        get: API_LIST()['getProjectSchedule'],
        added: 'posProjectSchedule',
        options: [
            Permission.findIndex(v => v.uuid === '32d7ed58-a922-44aa-8fde-aeb5ecdae041') !== -1 && (
                <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="添加阶段信息" />
            ),
        ],
        columns: [
            {
                dataIndex: 'organizationUuid',
                title: 'organizationUuid',
                valueType: 'hidden',
                hideInTable: true,
            },
            {
                dataIndex: 'projectScheduleType',
                title: '项目阶段',
                valueType: 'select',
                valueEnum: BuiltInData.projectScheduleType,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'startMonth',
                title: '开始时间',
                valueType: 'Date',
                showTime: true,
                rules: true,
                width: 150,
            },
            {
                dataIndex: 'endMonth',
                title: '结束时间',
                valueType: 'Date',
                showTime: true,
                rules: true,
                width: 150,
            },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === '3c463a09-f02c-479f-a32d-d58b678a9bf6') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url="ProjectSchedule"
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return dataList
}
